
PRG_NAME :=client

CFLAGS +=-I/home/zengwen/sqlite3/include

LDFLAGS +=-L/home/zengwen/sqlite3/lib -lsqlite3 -lpthread -ldl

PREFIX = ../install

CC := gcc


all : shared_lib shared_link 
	
shared_lib : 
	$(CC) -fPIC -shared *.c -o lib${PRG_NAME}.so ${CFLAGS} ${LDFLAGS} -w

shared_link:
	$(CC) client_main.c -o ${PRG_NAME} -I${PREFIX}/include -L${PREFIX}/lib -l${PRG_NAME} ${CFLAGS} ${LDFLAGS}

install :
	mkdir -p ${PREFIX}/lib 
	mkdir -p ${PREFIX}/include
	cp lib*.so ${PREFIX}/lib 
	cp *.h ${PREFIX}/include

run:
	export LD_LIBRARY_PATH=/home/zengwen/ds18b20_socket/install/lib

.PHONY : clean 
clean :
	rm -f *.o

cleanall : clean
	rm -f *.so *.a

